package com.sanjiahantang.youjiarole.module.evaluate.views.impl;

import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.RadioGroup;

import com.sanjiahantang.youjiarole.R;
import com.sanjiahantang.youjiarole.base.BaseMvpActivity;
import com.sanjiahantang.youjiarole.module.evaluate.presenters.MeEvaluatePresenter;
import com.sanjiahantang.youjiarole.module.evaluate.views.MeEvaluateView;


/**
 * Created by zy on 2017/9/6.
 * 我的评价
 */

public class MeEvaluateActivity extends BaseMvpActivity<MeEvaluateView,MeEvaluatePresenter>
        implements MeEvaluateView,View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
    private RadioGroup rgTabs;
    private View back;
    private RecyclerView recyclerView;
    private LinearLayoutManager layoutManager;
    private SwipeRefreshLayout refreshLayout;
    @Override
    public void showProgress() {
        super.showProgress($this);
    }

    @Override
    public MeEvaluatePresenter initPresenter() {
        return new MeEvaluatePresenter();
    }

    @Override
    public void initView() {
        setContentView(R.layout.activity_me_evaluate);
        rgTabs = (RadioGroup) findViewById(R.id.rgTabs);
        recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
        layoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        refreshLayout = (SwipeRefreshLayout) findViewById(R.id.refreshLayout);
        refreshLayout.setOnRefreshListener(this);
        back = findViewById(R.id.fl_Left);

        back.setOnClickListener(this);

        presenter.onCheckedChanged($this,true);
    }

    @Override
    public void initData() {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.fl_Left:
                finish();
                break;
        }
    }
    @Override
    public void onBackPressed() {
        finish();
    }


    @Override
    public void loadData(RecyclerView.Adapter adapter) {
        recyclerView.setAdapter(adapter);
        refreshLayout.setRefreshing(false);
    }

    @Override
    public void onRefresh() {
        presenter.onCheckedChanged($this,false);
    }
}
